package xin.nick.demo;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMQConfig3 {
    private final String queueName = "spring-boot";
    private final String exchangeName = "spring-boot-exchange-1";


    @Bean
    Queue queue() {
        return new Queue(queueName);
    }

    @Bean
    TopicExchange fanoutExchange() {
        return new TopicExchange(exchangeName);
    }

    @Bean
    Binding binding(Queue queue, TopicExchange fanoutExchange) {
        return BindingBuilder.bind(queue).to(fanoutExchange).with("xin.nick.demo");
    }
}
